package com.program.cloudmanage.tripteam.persistence;

import com.program.cloudmanage.tripteam.domain.Person;
import com.program.cloudmanage.tripteam.domain.TripTeam;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface PersonMapper {
    @Select("select * from person")
    List<Person> showPerson();
    @Select("select * from person where person.personid = #{personid}")
    Person searchPerson(String personid);
    @Select("select * from person where person.teamid = #{teamid}")
    List<Person> searchPersonByTeamId(String teamid);
    @Select("select * from person where person.carid = #{carid}")
    Person searchPersonByCarId(String carid);
    @Insert("insert into person(personid,type,carid,age,personname,teamid) values (#{personid},#{type},#{carid},#{age},#{personname},#{teamid})")
    void insertPerson(@Param("personid") String personid, @Param("type") String type, @Param("carid") String carid,@Param("age")String age,@Param("personname")String personname,@Param("teamid")String teamid);
    @Delete("delete from person where personid = #{personid}")
    void deletePerson(String personid);

    @Update("update person set type=#{type},carid=#{carid},age=#{age},personname=#{personname} where personid=#{personid}")
    void updatePerson(@Param("personid") String personid,@Param("type") String type,@Param("carid")String carid,@Param("age")String age,@Param("personname")String personname);
}
